package com.ssm.pre.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ssm.pre.service.UserService;
import com.ssm.util.object.InputObject;
import com.ssm.util.object.OutputObject;

/**
 * 管理员登录以及获取管理员信息、维修人员的增删改查和微信用户注册及绑定
 * @author 马培淞
 *
 */
@Controller
public class UserController {
	
	@Autowired
	private UserService userService;
	
	/**
	 * 登录验证
	 */
	@RequestMapping("/post/UserController/queryAdminByLogin")
	@ResponseBody
	public void queryAdminByLogin(InputObject inputObject, OutputObject outputObject) throws Exception{
		userService.queryAdminByLogin(inputObject, outputObject);
	}
	
	/**
	 * 查询用户管理员列表
	 * @param inputObject
	 * @param outputObject
	 * @throws Exception
	 */
	@RequestMapping("/post/UserController/queryAdminByList")
	@ResponseBody
	public void queryAdminByList(InputObject inputObject ,OutputObject outputObject) throws Exception{
		userService.queryAdminByList(inputObject, outputObject);
	}
	
	/**
	 * 获取登录信息
	 * @param inputObject
	 * @param outputObject
	 * @throws Exception
	 */
	@RequestMapping("/post/UserController/queryUserByLogin")
	@ResponseBody
	public void queryUserByLogin(InputObject inputObject, OutputObject outputObject) throws Exception{
		userService.queryUserByLogin(inputObject, outputObject);
	}

	/**
	 * 增加维修人员信息
	 * @param inputObject
	 * @param outputObject
	 * @throws Exception
	 */
	@RequestMapping("/post/UserController/addServiceMan")
	@ResponseBody
	public void addServiceMan(InputObject inputObject, OutputObject outputObject) throws Exception{
		userService.addServiceMan(inputObject, outputObject);
	}
	
	/**
	 * 根据ID删除维修人员
	 * @param inputObject
	 * @param outputObject
	 * @throws Exception
	 */
	@RequestMapping("/post/UserController/deleteServiceManById")
	@ResponseBody
	public void deleteServiceManById(InputObject inputObject, OutputObject outputObject) throws Exception{
		userService.deleteServiceManById(inputObject, outputObject);
	}
	
	/**
	 * 根据ID修改维修人员信息
	 * @param inputObject
	 * @param outputObject
	 * @throws Exception
	 */
	@RequestMapping("/post/UserController/updateServiceManById")
	@ResponseBody
	public void updateServiceManById(InputObject inputObject, OutputObject outputObject) throws Exception{
		userService.updateServiceManById(inputObject, outputObject);
	}
	
	/**
	 * 查询维修人员信息
	 * @param inputObject
	 * @param outputObject
	 * @throws Exception
	 */
	@RequestMapping("/post/UserController/queryServiceManByList")
	@ResponseBody
	public void queryServiceManByList(InputObject inputObject, OutputObject outputObject) throws Exception{
		userService.queryServiceManByList(inputObject, outputObject);
	}
	
	/**
	 * 根据ID查询维修人员
	 * @param inputObject
	 * @param outputObject
	 * @throws Exception
	 */
	@RequestMapping("/post/UserController/queryServiceManOneById")
	@ResponseBody
	public void queryServiceManOneById(InputObject inputObject ,OutputObject outputObject) throws Exception{
		userService.queryServiceManOneById(inputObject, outputObject);
	}
	
}